package com.example.blog.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName: FoodInfo
 * @Description: 帖子

 * @Date 2023/9/9
 * @Version 1.0
 */
@Table(name = "postsInfo")
@Data
@Slf4j
@Entity
@Builder
@DynamicInsert
@DynamicUpdate
@AllArgsConstructor
@NoArgsConstructor
public class PostsInfo {
    @Id
    @GeneratedValue(generator = "faceset_generator")
    @GenericGenerator(name = "faceset_generator", strategy = "uuid")
    @Column(name = "id",nullable = false,columnDefinition = "varchar(64) not null comment '主键id'")
    private String id;
    @Column(name = "name",nullable = false,columnDefinition ="varchar(128)  comment '帖子名称'")
    private String name;
    @Column(name = "creTime",nullable = false,columnDefinition ="datetime  comment '创建日期'")
    private Date creTime;
    @Lob
    @Basic(fetch=FetchType.LAZY)
    private String content;
    @Column(name = "creUser",insertable = true,updatable = false,columnDefinition ="varchar(128) not null comment '创建者'")
    private String creUser;
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "updateTime",columnDefinition ="datetime  comment '更新时间'")
    private Date updateTime;
    @Column(name = "updUser",columnDefinition ="varchar(128)  comment '更新者'")
    private String updUser;
    @Column(name = "hotStatus",columnDefinition ="bit(1)  comment '是否热门 0--true 1-- false'")
    private Boolean hotStatus;
    @Column(name = "classId",columnDefinition ="varchar(128)  comment '帖子分类'")
    private String classId;
    @Column(name = "className",columnDefinition ="varchar(128)  comment '帖子分类-名称'")
    private String className;
    @Column(name = "userId",nullable = false,columnDefinition ="varchar(128)  comment '评论者'")
    private String userId;
    @Column(name = "commentCount",nullable = false,columnDefinition ="int(128)  comment '评论者'")
    private int commentCount;
    @Column(name = "likeCount",nullable = false,columnDefinition ="int(128) comment '评论者'")
    private int likeCount;
    @Column(name = "followCount",nullable = false,columnDefinition ="int(128) comment '评论者'")
    private int followCount;
    @Column(name = "title",nullable = false,columnDefinition ="varchar(128)  comment '评论者'")
    private String title;
}
